<!DOCTYPE html>
<!-- Made By mc之光工作室-可爱的纯甄~(mcAmiya) -->
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="icon" href="../favicon.ico" />
        <title>你的作业完成了吗？</title>
    </head>
<body>

<h2>Amiyaの任务列表(最近50条)</h2>
别问 问就是能用就行
<p class="wakeUp"><a id="update_link" href="../index.html">点我回到主页</a></p>
<div id="task_list"></div>

<style>
    a{text-decoration:none} 
    a:hover{text-decoration:none} 
</style> 

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
var access_token = '6ff9dd8c-dcbf-414f-8a02-6c693de20b7e';
var url = 'https://zyzx-s.zy.com/api/1/aipt/get_tasks?pageNo=1&pageSize=50&finished=false&access_token=' + access_token;
axios.get(url)
    .then(function(result){
        // console.log(result.data)
        var json = JSON.stringify(result.data);
        // console.log(json)
        if (json) {
            // 把json转换为js对象
            var obj = JSON.parse(json);
            
            var div = document.getElementById('task_list')
            
            for (var i=0;i<obj.data.list.length;i++){
                var point = '&nbsp;&bull;&nbsp;'
                var str = obj.data.list[i]['subject_name'] + '<br>' + point + obj.data.list[i].task_name + '<br>&nbsp;&bull;&nbsp;发布日期: ' + obj.data.list[i]['publish_time'] + '<br>&nbsp;&bull;&nbsp;截止日期: ' + obj.data.list[i].deadline + "<br><br>";
                var test_url = obj.data.list[i]['resource_list'][0]['resource_preview_url'];

                var task = document.createElement("a");
                task.href = test_url;
                task.innerHTML = str;
                div.appendChild(task);

            }
            // div.innerHTML = str.link(test_url);
            return obj;
        }
    });

</script>

</body>
</html>